<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>登录</title>
		<link rel="stylesheet" href="../../assets/css/relys/login.css">
	</head>
	<body>
		<div class="wrapper" >
<!--			<span class="icon-close"><ion-icon name="close-outline"></ion-icon></span>-->
			<div class="form-box login" id="login">
				<h2>登录</h2>
				<form action="#">
					<div class="input-box">
						<span class="icon"><ion-icon name="person-circle"></ion-icon></span>
						<input v-model="username" type="text" required>
						<label>账号</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="lock-closed"></ion-icon></span>
						<input v-model="password" type="password" required>
						<label>密码</label>
					</div>
<!--					<div class="remember-forget">-->
<!--						<label><input type="checkbox">Remember me</label>-->
<!--						<a href="#">Forget Password?</a>-->
<!--					</div>-->
					<button type="submit" class="btn_userlogin" @click="userLogin1">用户登录</button>
					<button type="submit" class="btn_companylogin" @click="userLogin2">企业登录</button>
					<div class ="login-register"><p>尚未有账号?
						<a href="../yonghu/register.html" class="userregister-link">用户注册</a>/
						<a href="../qiyexinxi/register.html" class="companyregister-link">企业注册</a></p>
					</div>
				</form>
			</div>
			<div class="form-box userregister" id="userregister">
				<h2>用户注册</h2>
				<form action="#">
					<div class="input-box">
						<span class="icon"><ion-icon name="person-circle"></ion-icon></span>
						<input v-model="username" type="text" required>
						<label>账号</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="lock-closed"></ion-icon></span>
						<input v-model="mima" type="password" required>
						<label>密码</label>
					</div>
					<div class="input-box">
						<span  class="icon"><ion-icon name="person"></ion-icon></span>
						<input v-model="xingming" type="text" required>
						<label>姓名</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="call"></ion-icon></span>
						<input v-model="dianhua" type="text" required>
						<label>联系方式</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="mail"></ion-icon></span>
						<input v-model="youxiang" type="email" required>
						<label>邮箱</label>
					</div>
					<button type="submit" class="btn">注册</button>
					<div class ="login-register"><p>已有账号?
						<a href="#" class="userlogin-link">登录</a></p></div>
				</form>
			</div>
			<div class="form-box companyregister" id="companyregister">
				<h2>企业注册</h2>
				<form action="#">
					<div class="input-box">
						<span class="icon"><ion-icon name="person-circle"></ion-icon></span>
						<input v-model="username" type="text" required>
						<label>账号</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="lock-closed"></ion-icon></span>
						<input v-model="mima" type="password" required>
						<label>密码</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="people"></ion-icon></span>
						<input v-model="qiyemingcheng" type="text" required>
						<label>企业名称</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="person"></ion-icon></span>
						<input v-model="fuzeren" type="text" required>
						<label>负责人</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="call"></ion-icon></span>
						<input v-model="lianxidianhua" type="text" required>
						<label>联系方式</label>
					</div>
					<div class="input-box">
						<span class="icon"><ion-icon name="mail"></ion-icon></span>
						<input v-model="qiyeyouxiang" type="email" required>
						<label>企业邮箱</label>
					</div>
					<button type="button" class="btn">注册</button>
					<div class ="login-register"><p>已有账号?
						<a href="#" class="companylogin-link">登录</a></p></div>
				</form>
			</div>
		</div>
		<script src="../../assets/js/relys/jquery.js"></script>
		<script src="../../assets/js/relys/vue.js"></script>
		<script src="../../assets/js/api/api.js"></script>
		<script src="../../assets/js/api/defaultuser.js"></script>

	<script src="./login.js" type="module"></script>
		<script type="module">//type="text/javascript"
/*			import MyPlugin from "./login.js"//TODO 页面跳转修正
			export default {
			  mounted() {
				MyPlugin.doSomething()
			  }
			}*/
			var login1 = new Vue({
				el: "#login",
				data: {
					pick1: "yonghu",
					pick2: "qiyexinxi",
					yonghu: "yonghuming",
					yonghuzn: "用户",
					qiyexinxi: "qiyebianhao",
					qiyexinxizn: "企业信息",
					username: '',
					password: ''
				},
				methods: {
					userLogin1(){

						var data = {
							username: this.username,
							password: this.password,

						}
						data[`${this[this.pick1]}`] = this.username
						login(`${this.pick1}`, data, (res)=>{
							if(res.code==0){
								alert("登录成功")
								localStorage.setItem('Token', res.token)
								localStorage.setItem("role", this[`${this.pick1}zn`])
								localStorage.setItem('sessionTable', this.pick1)
								localStorage.setItem('adminName', this.username)
								session(this.pick1, (res) => {
									if(res.code==0){
										var userid = res.data.id
										localStorage.setItem('userid', userid)
										window.parent.location.href = `../../index.html`
									}
								})
							}
						})
					},
					userLogin2(){
						alert("ddd")
						var data = {
							username: this.username,
							password: this.password,

						}
						data[`${this[this.pick2]}`] = this.username
						login(`${this.pick2}`, data, (res)=>{
							if(res.code==0){
								alert("登录成功")
								localStorage.setItem('Token', res.token)
								localStorage.setItem("role", this[`${this.pick2}zn`])
								localStorage.setItem('sessionTable', this.pick2)
								localStorage.setItem('adminName', this.username)
								session(this.pick2, (res) => {
									if(res.code==0){
										var userid = res.data.id
										localStorage.setItem('userid', userid)
										window.parent.location.href = `../../index.html`
									}
								})
							}
						})
					}
				}
			})
			var userregister = new Vue({
				el: "#userregister",
				data: {
					username: '',
					mima: '',
					xingming: '',
					dianhua: '',
					youxiang: '',
				},
				methods: {
					userRegister(){
						var data = {
							yonghuming: this.username,
							mima: this.mima,
							xingming: this.xingming,
							dianhua: this.dianhua,
							youxiang: this.youxiang,
						}
						register('yonghu', data, function(res){
							if(res.code==0){
								alert('注册成功')
								window.parent.location.href = '../login/login.html'
							}
						})
					}
				}
			})
			var companyregister = new Vue({
				el: "#companyregister",
				data: {
					username: '',
					mima: '',
					qiyemingcheng: "",
					fuzeren: "",
					lianxidianhua: "",
					qiyeyouxiang: "",
				},
				methods: {
					userRegister(){
						var data = {
							qiyebianhao: this.username,
							mima: this.mima,
							qiyemingcheng: this.qiyemingcheng,
							fuzeren: this.fuzeren,
							lianxidianhua: this.lianxidianhua,
							qiyeyouxiang: this.qiyeyouxiang,
						}
						register('qiyexinxi', data, function(res){
							if(res.code==0){
								alert('注册成功')
								window.parent.location.href = '../login/login.html'
							}
						})
					}
				}
			})
		</script>
		<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
		<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
	</body>
</html>
<!---->
<!--<!DOCTYPE html>-->
<!--<html lang="en">-->
<!--<head>-->
<!--	<meta charset="UTF-8">-->
<!--	<title>登录</title>-->
<!--	<link rel="stylesheet" href="../../assets/css/relys/login.css">-->
<!--</head>-->
<!--<body>-->
<!--<div class="container" id="app">-->
<!--	<div class="loginBox">-->
<!--		<h3>登录</h3>-->
<!--		<form id="loginForm">-->
<!--			<div class="input-wrapper">-->
<!--				<label>账号:</label>-->
<!--				<input v-model="username" type="email" name="" placeholder="请输入账号">-->
<!--			</div>-->
<!--			<div class="input-wrapper">-->
<!--				<label>密码:</label>-->
<!--				<input v-model="password" type="password" name="" placeholder="密码">-->
<!--			</div>-->
<!--		</form>-->
<!--		<div style="display: flex;justify-content: space-between;">-->
<!--			<div style="display: flex;flex-flow: column;line-height: 25px;">-->
<!--				<a href="../yonghu/register.html">用户注册</a>-->
<!--				<a href="../qiyexinxi/register.html">企业信息注册</a>-->
<!--			</div>-->
<!--		</div>-->
<!--		<div class="checkbox" style="display: flex;margin-top: 20px;">-->
<!--			<div style="margin-right: 40px;display: flex;align-items: center;">-->
<!--				<input style="width: 15px;margin: 0;margin-right: 10px;" type="radio" value="yonghu" v-model="pick">用户-->
<!--			</div>-->
<!--			<div style="margin-right: 40px;display: flex;align-items: center;">-->
<!--				<input style="width: 15px;margin: 0;margin-right: 10px;" type="radio" value="qiyexinxi" v-model="pick">企业信息-->
<!--			</div>-->
<!--		</div>-->
<!--		<button type="button" @click="userLogin">登录</button>-->
<!--	</div>-->
<!--</div>-->
<!--<script src="../../assets/js/relys/jquery.js"></script>-->
<!--<script src="../../assets/js/relys/vue.js"></script>-->
<!--<script src="../../assets/js/api/api.js"></script>-->
<!--<script src="../../assets/js/api/defaultuser.js"></script>-->
<!--<script type="text/javascript">-->
<!--			var app = new Vue({-->
<!--				el: "#app",-->
<!--				data: {-->
<!--					pick: "",-->
<!--					yonghu: "yonghuming",-->
<!--					yonghuzn: "用户",-->
<!--					qiyexinxi: "qiyebianhao",-->
<!--					qiyexinxizn: "企业信息",-->
<!--					username: '',-->
<!--					password: ''-->
<!--				},-->
<!--				methods: {-->
<!--					userLogin(){-->
<!--						if(!this.pick){-->
<!--							alert("请选择登录用户")-->
<!--							return-->
<!--						}-->

<!--						var data = {-->
<!--							username: this.username,-->
<!--							password: this.password,-->
<!--							mima: this.password,-->
<!--						}-->
<!--						data[`${this[this.pick]}`] = this.username-->
<!--						login(`${this.pick}`, data, (res)=>{-->
<!--							if(res.code==0){-->
<!--								alert("登录成功")-->
<!--								localStorage.setItem('Token', res.token)-->
<!--								localStorage.setItem("role", this[`${this.pick}zn`])-->
<!--								localStorage.setItem('sessionTable', this.pick)-->
<!--								localStorage.setItem('adminName', this.username)-->
<!--								session(this.pick, (res) => {-->
<!--									if(res.code==0){-->
<!--										var userid = res.data.id-->
<!--										localStorage.setItem('userid', userid)-->
<!--										window.parent.location.href = `../../index.html`-->
<!--									}-->
<!--								})-->
<!--							}-->
<!--						})-->
<!--					}-->
<!--				}-->
<!--			})-->
<!--		</script>-->

<!--</body>-->
<!--</html>-->

